package com.ihd.ihardware.view.scooter.viewModel;

import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.support.annotation.NonNull;

import com.ihd.ihardware.view.scooter.model.SCRepository;

public class SCViewModel extends AndroidViewModel {

    private SCRepository mSCRepository;

    public SCViewModel(@NonNull Application application) {
        super(application);
    }

    public void unbind(String id) {
        if (mSCRepository == null)
            mSCRepository = new SCRepository();
        mSCRepository.unbind(id);
    }

    @Override
    protected void onCleared() {
        super.onCleared();
        if (null != mSCRepository) {
            mSCRepository.onDestroy();
            mSCRepository = null;
        }
    }
}
